#include "stm32f10x.h"                  // Device header
#include "OLED.h"
#include "LED.h"
#include "AD.h"
#include "Delay.h"

uint16_t AD_value;
float Voltage;

int main(void)
{
	OLED_Init();
	LED_Init();
	AD_Init();
	OLED_ShowString(1,1,"ADvalue:");
	OLED_ShowString(2,1,"Voltage:0.00V");
	while(1)
	{
		AD_value = AD_GetValue();
		Voltage = (3.3 / 4095) * (float)AD_value;
//		OLED_ShowNum(1, 9, AD_value, 5);
		OLED_ShowNum(2, 9, Voltage, 1);
		OLED_ShowNum(2, 11, (uint16_t)(Voltage * 100) % 100, 2);
		Delay_ms(100);
	}
}
